package com.xian;

/**
 * @Author: yanjunfeng
 * @Description: TODO
 * @Date: Created in 上午9:09 2022/7/14
 * @Modified By:
 */

/**
 * 时薪员工
 */
public class HourlyEmployee extends Employee  {
    private int hour;//总时长
    private double hourlyWage;// 时薪


    public int getHour() {
        return hour;
    }

    public void setHour(int hour) {
        this.hour = hour;
    }

    public double getHourlyWage() {
        return hourlyWage;
    }

    public void setHourlyWage(double hourlyWage) {
        this.hourlyWage = hourlyWage;
    }

    public HourlyEmployee(String name, int month,int hour,double hourlyWage) {
        super(name, month);
        this.hour=hour;
        this.hourlyWage=hourlyWage;
    }

    @Override
    public double getSalary() {
        double salary=0;
        if(this.hour>160){//超出160部分按时薪1.5计算
           salary=160*this.hourlyWage+(this.hour-160)*this.hourlyWage*1.5+this.getSalarybyBri();
        }else{
            salary=this.hour*this.hourlyWage+this.getSalarybyBri();
        }
        return salary;
    }
}
